import java.net.InetSocketAddress;


public class InetSocketAddressDemo {

	public static void main(String[] args) {
		InetSocketAddress portOnly = new InetSocketAddress(8888);
		dmp("port only",portOnly);
		InetSocketAddress emptyHostName = new InetSocketAddress("", 8888);
		dmp("empty hostname",emptyHostName);
		InetSocketAddress anyHostName = new InetSocketAddress("*", 8888);
		dmp("any hostname",anyHostName);
		InetSocketAddress regularHostName = new InetSocketAddress("googe.com", 8888);
		dmp("regular hostname",regularHostName);
		InetSocketAddress unknownHostName = new InetSocketAddress("abadjiev.bg", 8888);
		dmp("unknown hostname",unknownHostName);		
		InetSocketAddress nullHostName = new InetSocketAddress((String)null, 8888);
		dmp("null hostname",nullHostName);
	}

	public static void dmp(String prefix, InetSocketAddress address) {
		System.out.printf("%s hostname: %s%n",prefix,address.getHostName());
		System.out.printf("%s port: %s%n",prefix,address.getPort());
		System.out.printf("%s is unresolved: %s%n",prefix,address.isUnresolved());
	}
}
